package com.pgeg.listener;

import com.pgeg.materials.ModToolMaterials;
import com.pgeg.registry.ItemGroupRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.*;

public class ToolListener {


    /*Axes*/
    public static final Item ORICHALCUM_AXE = genAxeItemSettings(ModToolMaterials.ORICHALCUM);
    public static final Item SATURNIUM_AXE = genAxeItemSettings(ModToolMaterials.SATURNIUM);
    public static final Item BRIMSTONE_AXE = genAxeItemSettings(ModToolMaterials.BRIMSTONE);
    public static final Item METEORITE_AXE = genAxeItemSettings(ModToolMaterials.METEORITE);
    public static final Item MITHRIL_AXE = genAxeItemSettings(ModToolMaterials.MITHRIL);
    public static final Item COPPER_AXE = genAxeItemSettings(ModToolMaterials.COPPER_TOOL_MATERIALS);
    public static final Item SILVER_AXE = genAxeItemSettings(ModToolMaterials.SILVER_TOOL_MATERIALS);
    public static final Item SANDSTONE_AXE = genAxeItemSettings(ModToolMaterials.SANDSTONE_TOOL_MATERIALS);
    public static final Item REDSTONE_AXE = genAxeItemSettings(ModToolMaterials.REDSTONE_TOOL_MATERIALS);

    /*Pickaxes*/
    public static final Item ORICHALCUM_PICKAXE = genPickaxeItemSettings(ModToolMaterials.ORICHALCUM);
    public static final Item SATURNIUM_PICKAXE = genPickaxeItemSettings(ModToolMaterials.SATURNIUM);
    public static final Item BRIMSTONE_PICKAXE = genPickaxeItemSettings(ModToolMaterials.BRIMSTONE);
    public static final Item METEORITE_PICKAXE = genPickaxeItemSettings(ModToolMaterials.METEORITE);
    public static final Item MITHRIL_PICKAXE = genPickaxeItemSettings(ModToolMaterials.MITHRIL);
    public static final Item COPPER_PICKAXE = genPickaxeItemSettings(ModToolMaterials.COPPER_TOOL_MATERIALS);
    public static final Item SILVER_PICKAXE = genPickaxeItemSettings(ModToolMaterials.SILVER_TOOL_MATERIALS);
    public static final Item SANDSTONE_PICKAXE = genPickaxeItemSettings(ModToolMaterials.SANDSTONE_TOOL_MATERIALS);
    public static final Item REDSTONE_PICKAXE = genPickaxeItemSettings(ModToolMaterials.REDSTONE_TOOL_MATERIALS);

    /*Shovels*/
    public static final Item ORICHALCUM_SHOVEL = genShovelItemSettings(ModToolMaterials.ORICHALCUM);
    public static final Item SATURNIUM_SHOVEL = genShovelItemSettings(ModToolMaterials.SATURNIUM);
    public static final Item BRIMSTONE_SHOVEL = genShovelItemSettings(ModToolMaterials.BRIMSTONE);
    public static final Item METEORITE_SHOVEL = genShovelItemSettings(ModToolMaterials.METEORITE);
    public static final Item MITHRIL_SHOVEL = genShovelItemSettings(ModToolMaterials.MITHRIL);
    public static final Item COPPER_SHOVEL = genShovelItemSettings(ModToolMaterials.COPPER_TOOL_MATERIALS);
    public static final Item SILVER_SHOVEL = genShovelItemSettings(ModToolMaterials.SILVER_TOOL_MATERIALS);
    public static final Item SANDSTONE_SHOVEL = genShovelItemSettings(ModToolMaterials.SANDSTONE_TOOL_MATERIALS);
    public static final Item REDSTONE_SHOVEL = genShovelItemSettings(ModToolMaterials.REDSTONE_TOOL_MATERIALS);

    /*Hoes*/
    public static final Item ORICHALCUM_HOE = genHoeItemSettings(ModToolMaterials.ORICHALCUM);
    public static final Item SATURNIUM_HOE = genHoeItemSettings(ModToolMaterials.SATURNIUM);
    public static final Item BRIMSTONE_HOE = genHoeItemSettings(ModToolMaterials.BRIMSTONE);
    public static final Item METEORITE_HOE = genHoeItemSettings(ModToolMaterials.METEORITE);
    public static final Item MITHRIL_HOE = genHoeItemSettings(ModToolMaterials.MITHRIL);
    public static final Item COPPER_HOE = genHoeItemSettings(ModToolMaterials.COPPER_TOOL_MATERIALS);
    public static final Item SILVER_HOE = genHoeItemSettings(ModToolMaterials.SILVER_TOOL_MATERIALS);
    public static final Item SANDSTONE_HOE = genHoeItemSettings(ModToolMaterials.SANDSTONE_TOOL_MATERIALS);
    public static final Item REDSTONE_HOE = genHoeItemSettings(ModToolMaterials.REDSTONE_TOOL_MATERIALS);

    /*Shears*/
    public static final Item ORICHALCUM_SHEARS = genShearsItemSettings(357);
    public static final Item SATURNIUM_SHEARS = genShearsItemSettings(476);
    public static final Item BRIMSTONE_SHEARS = genShearsItemSettings(476);
    public static final Item METEORITE_SHEARS = genShearsItemSettings(476);
    public static final Item MITHRIL_SHEARS = genShearsItemSettings(595);

    private static AxeItem genAxeItemSettings(ToolMaterial material) {
        return new AxeItem(material, 5.0F, -3F, new FabricItemSettings().group(ItemGroupRegistry.TOOL_GROUP));
    }

    private static PickaxeItem genPickaxeItemSettings(ToolMaterial material) {
        return new PickaxeItem(material, 1, -2.8F, new FabricItemSettings().group(ItemGroupRegistry.TOOL_GROUP));
    }

    private static ShovelItem genShovelItemSettings(ToolMaterial material) {
        return new ShovelItem(material, 1.5f, -3F, new FabricItemSettings().group(ItemGroupRegistry.TOOL_GROUP));
    }

    private static HoeItem genHoeItemSettings(ToolMaterial material) {
        return new HoeItem(material, 1, -3F,new FabricItemSettings().group(ItemGroupRegistry.TOOL_GROUP));
    }

    private static ShearsItem genShearsItemSettings(int damage) {
        return new ShearsItem(new FabricItemSettings().maxDamage(damage).group(ItemGroupRegistry.TOOL_GROUP));
    }
}
